package xyz.yeidi.service.impl;

import xyz.yeidi.dao.api.DeliveryAddressDao;
import xyz.yeidi.dao.impl.DeliveryAddressDaoImpl;
import xyz.yeidi.pojo.Deliveryaddress;
import xyz.yeidi.service.api.DeliveryAddressService;
import xyz.yeidi.utils.ConnUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author JIP
 * @Date 2021-08-06 11:00
 * @Version 1.0
 * @Describe :
 */
public class DeliveryAddressServiceImpl implements DeliveryAddressService {
    DeliveryAddressDao deliveryAddressDao = new DeliveryAddressDaoImpl();
    @Override
    public List<Deliveryaddress> getAllAddressByUserId(Integer userId) {
        try {
            return deliveryAddressDao.getAllAddressByUserId(userId);
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            ConnUtils.close();
        }
        return null;
    }

    @Override
    public Deliveryaddress getAddressById(Integer id) {
        return null;
    }

    @Override
    public boolean addAddress(Deliveryaddress deliveryaddress) {
        try {
            return deliveryAddressDao.addAddress(deliveryaddress);
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            ConnUtils.close();
        }
        return false;
    }
}
